package xyz.yinpeng.demo.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import xyz.yinpeng.demo.service.TestService;

@RestController
public class TestController {
    @Autowired
    private TestService testService;

    @RequestMapping("/consumer/test")
    public Object test(String name, String method) {
        Object result = null;
        if ("1".equals(method)) {
            result = this.testService.sayHello1(name);
        } else if ("2".equals(method)) {
            result = this.testService.sayHello2(name);
        } else {
            result = this.testService.sayHello3(name);
        }

        return ResponseEntity.ok(result);
    }

}
